GtkAppChooser: Drop PackageKit integration
authorMatthias Clasen <mclasen@redhat.com>
Wed, 18 Dec 2013 01:49:28 +0000 (20:49 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 18 Dec 2013 03:07:40 +0000 (22:07 -0500)
This will come back in a simpler form in the next
commit.

configure.ac
gtk/Makefile.am
gtk/gtkappchooserdialog.c
gtk/gtkappchoosermodule.c [deleted file]
gtk/gtkappchoosermodule.h [deleted file]
gtk/gtkappchooseronline.c [deleted file]
gtk/gtkappchooseronline.h [deleted file]
gtk/gtkappchooseronlinepk.c [deleted file]
gtk/gtkappchooseronlinepk.h [deleted file]

index d14103c521faa388dbd5f0a9fecd7bba10025ce6..04c8f640ea3b769b08442af102d98c7d652ced4f 100644 (file)
@@ -1573,37 +1573,6 @@ GLIB_GSETTINGS
 
 GOBJECT_INTROSPECTION_CHECK(introspection_required_version)
 
-##################################################
-# Packagekit module
-#################################################
-
-AC_ARG_ENABLE(packagekit,
-              [AS_HELP_STRING([--enable-packagekit=@<:@yes/no/auto@:>@],
-                              [build PackageKit open-with module [default=auto]])],
-              [enable_packagekit="$enableval"],
-              [enable_packagekit=auto])
-if test "$enable_packagekit" = "auto"; then
-  if test "$os_win32" = "yes"; then
-    enable_packagekit=no
-  else
-    enable_packagekit=yes
-  fi
-fi
-
-AC_MSG_CHECKING([whether to use PackageKit])
-build_packagekit=no
-if test "x$enable_packagekit" != "xno"; then
-  if test "$os_win32" != "yes"; then
-    build_packagekit=yes
-    AC_DEFINE(ENABLE_PACKAGEKIT, 1, [define to enable packagekit])
-  else
-    AC_MSG_ERROR([packagekit support is not available on win32])
-  fi
-fi
-AC_MSG_RESULT([$build_packagekit])
-
-AM_CONDITIONAL(ENABLE_PACKAGEKIT, test "x$build_packagekit" = "xyes")
-
 ##################################################
 # colord module
 #################################################
@@ -1899,7 +1868,6 @@ fi
 echo "        Print backends:       $PRINT_BACKENDS"
 echo "        Dynamic modules:      $build_dynamic_modules"
 echo "        Included immodules:   $included_immodules"
-echo "        PackageKit support:   $build_packagekit"
 echo "        colord support:       $have_colord"
 echo "        Introspection:        $found_introspection"
 echo "        Debugging:            $enable_debug"
index 31c700eb3d134c0eb23e326da5f6ef1a2b82f1c1..ecbcbd14f2c51f19073617bd45d3e2330b80fc27 100644 (file)
@@ -388,16 +388,6 @@ endif
 gtk_semi_private_h_sources = \
        gtktextlayout.h
 
-if ENABLE_PACKAGEKIT
-gtk_appchooser_impl_h_sources = \
-       gtkappchooseronlinepk.h
-endif
-
-if ENABLE_PACKAGEKIT
-gtk_appchooser_impl_c_sources = \
-       gtkappchooseronlinepk.c
-endif
-
 gtk_private_type_h_sources =   \
        gtkcsstypesprivate.h    \
        gtktexthandleprivate.h
@@ -414,8 +404,6 @@ gtk_private_h_sources =             \
        gtkactionhelper.h       \
        gtkallocatedbitmaskprivate.h    \
        gtkappchooserprivate.h  \
-       gtkappchoosermodule.h   \
-       gtkappchooseronline.h   \
        gtkbindingsprivate.h    \
        gtkbitmaskprivate.h     \
        gtkbitmaskprivateimpl.h \
@@ -561,8 +549,7 @@ gtk_private_h_sources =             \
        gtkwindowprivate.h      \
        gtktreemenu.h           \
        $(gtk_private_type_h_sources) \
-       $(gtk_clipboard_dnd_h_sources) \
-       $(gtk_appchooser_impl_h_sources)
+       $(gtk_clipboard_dnd_h_sources)
 
 # GTK+ C sources to build the library from
 deprecated_c_sources =                         \
@@ -625,8 +612,6 @@ gtk_base_c_sources =                \
        gtkappchooserwidget.c   \
        gtkappchooserbutton.c   \
        gtkappchooserdialog.c   \
-       gtkappchoosermodule.c   \
-       gtkappchooseronline.c   \
        gtkapplication.c        \
        gtkapplicationimpl.c    \
        gtkapplicationwindow.c  \
@@ -904,8 +889,7 @@ gtk_base_c_sources =                \
        gtkwidgetpath.c         \
        gtkwindow.c             \
        gtkwin32theme.c         \
-       $(gtk_clipboard_dnd_c_sources) \
-       $(gtk_appchooser_impl_c_sources)
+       $(gtk_clipboard_dnd_c_sources)
 
 nodist_gtk_c_sources =
 gtk_c_sources = $(gtk_base_c_sources)
index 44c43c42202e3bfe519372245aeabda33f7e839a..2131baaf457878f5477d136237fd677c8a9a92ec 100644 (file)
@@ -43,8 +43,6 @@
 
 #include "gtkintl.h"
 #include "gtkappchooser.h"
-#include "gtkappchooseronline.h"
-#include "gtkappchooserprivate.h"
 #include "gtkappchooserprivate.h"
 
 #include "gtkmessagedialog.h"
@@ -66,7 +64,6 @@ struct _GtkAppChooserDialogPrivate {
 
   GtkWidget *label;
   GtkWidget *button;
-  GtkWidget *online_button;
   GtkWidget *inner_box;
 
   GtkWidget *open_label;
@@ -74,9 +71,6 @@ struct _GtkAppChooserDialogPrivate {
   GtkWidget *app_chooser_widget;
   GtkWidget *show_more_button;
 
-  GtkAppChooserOnline *online;
-  GCancellable *online_cancellable;
-
   gboolean show_more_clicked;
   gboolean dismissed;
 };
@@ -93,125 +87,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkAppChooserDialog, gtk_app_chooser_dialog, GTK_TYPE_D
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_APP_CHOOSER,
                                                 gtk_app_chooser_dialog_iface_init));
 
-static void
-show_error_dialog (const gchar *primary,
-                   const gchar *secondary,
-                   GtkWindow   *parent)
-{
-  GtkWidget *message_dialog;
-
-  message_dialog = gtk_message_dialog_new (parent, 0,
-                                           GTK_MESSAGE_ERROR,
-                                           GTK_BUTTONS_OK,
-                                           NULL);
-  g_object_set (message_dialog,
-                "text", primary,
-                "secondary-text", secondary,
-                NULL);
-  gtk_dialog_set_default_response (GTK_DIALOG (message_dialog), GTK_RESPONSE_OK);
-
-  gtk_widget_show (message_dialog);
-
-  g_signal_connect (message_dialog, "response",
-                    G_CALLBACK (gtk_widget_destroy), NULL);
-}
-
-static void
-search_for_mimetype_ready_cb (GObject      *source,
-                              GAsyncResult *res,
-                              gpointer      user_data)
-{
-  GtkAppChooserOnline *online = GTK_APP_CHOOSER_ONLINE (source);
-  GtkAppChooserDialog *self = user_data;
-  GError *error = NULL;
-
-  gdk_threads_enter ();
-
-  _gtk_app_chooser_online_search_for_mimetype_finish (online, res, &error);
-
-  if (self->priv->dismissed)
-    goto out;
-
-  if (error != NULL &&
-      !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-    {
-      show_error_dialog (_("Failed to look for applications online"),
-                         error->message, GTK_WINDOW (self));
-    }
-  else
-    {
-      gtk_widget_set_sensitive (self->priv->online_button, TRUE);
-      gtk_app_chooser_refresh (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
-    }
-
- out:
-  g_clear_object (&self->priv->online_cancellable);
-  g_clear_error (&error);
-  g_object_unref (self);
-
-  gdk_threads_leave ();
-}
-
-static void
-online_button_clicked_cb (GtkButton *b,
-                          gpointer   user_data)
-{
-  GtkAppChooserDialog *self = user_data;
-
-  self->priv->online_cancellable = g_cancellable_new ();
-  gtk_widget_set_sensitive (self->priv->online_button, FALSE);
-
-  _gtk_app_chooser_online_search_for_mimetype_async (self->priv->online,
-                                                    self->priv->content_type,
-                                                    GTK_WINDOW (self),
-                                                     self->priv->online_cancellable,
-                                                    search_for_mimetype_ready_cb,
-                                                    g_object_ref (self));
-}
-
-static void
-app_chooser_online_get_default_ready_cb (GObject *source,
-                                         GAsyncResult *res,
-                                         gpointer user_data)
-{
-  GtkAppChooserDialog *self = user_data;
-
-  gdk_threads_enter ();
-
-  self->priv->online = _gtk_app_chooser_online_get_default_finish (source, res);
-
-  if (self->priv->online != NULL &&
-      !self->priv->dismissed)
-    {
-      GtkWidget *action_area;
-
-      action_area = gtk_dialog_get_action_area (GTK_DIALOG (self));
-      self->priv->online_button = gtk_button_new_with_mnemonic (_("_Find applications online"));
-      gtk_box_pack_start (GTK_BOX (action_area), self->priv->online_button,
-                          FALSE, FALSE, 0);
-      gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), self->priv->online_button,
-                                          TRUE);
-      g_signal_connect (self->priv->online_button, "clicked",
-                        G_CALLBACK (online_button_clicked_cb), self);
-
-
-      if (!self->priv->content_type)
-       gtk_widget_set_sensitive (self->priv->online_button, FALSE);
-
-      gtk_widget_show (self->priv->online_button);
-    }
-
-  g_object_unref (self);
-
-  gdk_threads_leave ();
-}
-
-static void
-ensure_online_button (GtkAppChooserDialog *self)
-{
-  _gtk_app_chooser_online_get_default_async (app_chooser_online_get_default_ready_cb,
-                                             g_object_ref (self));
-}
 
 static void
 add_or_find_application (GtkAppChooserDialog *self)
@@ -231,16 +106,6 @@ add_or_find_application (GtkAppChooserDialog *self)
     }
 }
 
-static void
-cancel_and_clear_cancellable (GtkAppChooserDialog *self)
-{                                                               
-  if (self->priv->online_cancellable != NULL)
-    {
-      g_cancellable_cancel (self->priv->online_cancellable);
-      g_clear_object (&self->priv->online_cancellable);
-    }
-}
-
 static void
 gtk_app_chooser_dialog_response (GtkDialog *dialog,
                                  gint       response_id,
@@ -255,7 +120,6 @@ gtk_app_chooser_dialog_response (GtkDialog *dialog,
       break;
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_DELETE_EVENT:
-      cancel_and_clear_cancellable (self);
       self->priv->dismissed = TRUE;
     default :
       break;
@@ -524,7 +388,6 @@ gtk_app_chooser_dialog_constructed (GObject *object)
 
   construct_appchooser_widget (self);
   set_dialog_properties (self);
-  ensure_online_button (self);
 }
 
 static void
@@ -533,8 +396,6 @@ gtk_app_chooser_dialog_dispose (GObject *object)
   GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
   
   g_clear_object (&self->priv->gfile);
-  cancel_and_clear_cancellable (self);
-  g_clear_object (&self->priv->online);
 
   self->priv->dismissed = TRUE;
 
diff --git a/gtk/gtkappchoosermodule.c b/gtk/gtkappchoosermodule.c
deleted file mode 100644 (file)
index 151b365..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * gtkappchoosermodule.c: an extension point for online integration
- *
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <ccecchi@redhat.com>
- */
-
-#include "config.h"
-
-#include "gtkappchoosermodule.h"
-
-#include <gio/gio.h>
-
-#include "gtkappchooseronline.h"
-
-#ifdef ENABLE_PACKAGEKIT
-#include "gtkappchooseronlinepk.h"
-#endif
-
-G_LOCK_DEFINE_STATIC (registered_ep);
-
-void
-_gtk_app_chooser_module_ensure (void)
-{
-  static gboolean registered_ep = FALSE;
-  GIOExtensionPoint *ep;
-
-  G_LOCK (registered_ep);
-
-  if (!registered_ep)
-    {
-      registered_ep = TRUE;
-
-      ep = g_io_extension_point_register ("gtkappchooser-online");
-      g_io_extension_point_set_required_type (ep, GTK_TYPE_APP_CHOOSER_ONLINE);
-
-#ifdef ENABLE_PACKAGEKIT
-      _gtk_app_chooser_online_pk_get_type ();
-#endif
-    }
-
-  G_UNLOCK (registered_ep);
-}
diff --git a/gtk/gtkappchoosermodule.h b/gtk/gtkappchoosermodule.h
deleted file mode 100644 (file)
index b552948..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * gtkappchoosermodule.h: an extension point for online integration
- *
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <ccecchi@redhat.com>
- */
-
-#ifndef __GTK_APP_CHOOSER_MODULE_H__
-#define __GTK_APP_CHOOSER_MODULE_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-void _gtk_app_chooser_module_ensure (void);
-
-G_END_DECLS
-
-#endif /* __GTK_APP_CHOOSER_MODULE_H__ */
diff --git a/gtk/gtkappchooseronline.c b/gtk/gtkappchooseronline.c
deleted file mode 100644 (file)
index 7d72cf7..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * gtkappchooseronline.h: an extension point for online integration
- *
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <ccecchi@redhat.com>
- */
-
-#include "config.h"
-
-#include "gtkappchooseronline.h"
-
-#include "gtkappchoosermodule.h"
-#include "gtkintl.h"
-
-#include <gio/gio.h>
-
-G_DEFINE_INTERFACE_WITH_CODE (GtkAppChooserOnline, _gtk_app_chooser_online, G_TYPE_OBJECT,
-                              g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_ASYNC_INITABLE);)
-
-static void
-_gtk_app_chooser_online_default_init (GtkAppChooserOnlineInterface *iface)
-{
-  /* do nothing */
-}
-
-GtkAppChooserOnline *
-_gtk_app_chooser_online_get_default_finish (GObject      *source,
-                                            GAsyncResult *result)
-{
-  GtkAppChooserOnline *retval;
-
-  retval = GTK_APP_CHOOSER_ONLINE (g_async_initable_new_finish (G_ASYNC_INITABLE (source),
-                                                                result, NULL));
-
-  return retval;
-}
-
-void
-_gtk_app_chooser_online_get_default_async (GAsyncReadyCallback callback,
-                                           gpointer            user_data)
-{
-  GIOExtensionPoint *ep;
-  GIOExtension *extension;
-  GList *extensions;
-
-  _gtk_app_chooser_module_ensure ();
-
-  ep = g_io_extension_point_lookup ("gtkappchooser-online");
-  extensions = g_io_extension_point_get_extensions (ep);
-
-  if (extensions != NULL)
-    {
-      /* pick the first */
-      extension = extensions->data;
-      g_async_initable_new_async (g_io_extension_get_type (extension), G_PRIORITY_DEFAULT,
-                                  NULL, callback, user_data, NULL);
-    }
-}
-
-void
-_gtk_app_chooser_online_search_for_mimetype_async (GtkAppChooserOnline *self,
-                                                   const gchar         *content_type,
-                                                   GtkWindow           *parent,
-                                                   GCancellable        *cancellable,
-                                                   GAsyncReadyCallback  callback,
-                                                   gpointer             user_data)
-{
-  GtkAppChooserOnlineInterface *iface;
-
-  g_return_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self));
-
-  iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
-
-  (* iface->search_for_mimetype_async) (self, content_type, parent, cancellable, callback, user_data);
-}
-
-gboolean
-_gtk_app_chooser_online_search_for_mimetype_finish (GtkAppChooserOnline  *self,
-                                                    GAsyncResult         *res,
-                                                    GError              **error)
-{
-  GtkAppChooserOnlineInterface *iface;
-
-  g_return_val_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self), FALSE);
-
-  iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
-
-  return ((* iface->search_for_mimetype_finish) (self, res, error));
-}
diff --git a/gtk/gtkappchooseronline.h b/gtk/gtkappchooseronline.h
deleted file mode 100644 (file)
index 3487a24..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * gtkappchooseronline.h: an extension point for online integration
- *
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <ccecchi@redhat.com>
- */
-
-#ifndef __GTK_APP_CHOOSER_ONLINE_H__
-#define __GTK_APP_CHOOSER_ONLINE_H__
-
-#include <glib.h>
-
-#include <gtk/gtkwindow.h>
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_APP_CHOOSER_ONLINE           (_gtk_app_chooser_online_get_type ())
-#define GTK_APP_CHOOSER_ONLINE(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_APP_CHOOSER_ONLINE, GtkAppChooserOnline))
-#define GTK_IS_APP_CHOOSER_ONLINE(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_APP_CHOOSER_ONLINE))
-#define GTK_APP_CHOOSER_ONLINE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_APP_CHOOSER_ONLINE, GtkAppChooserOnlineInterface))
-
-typedef struct _GtkAppChooserOnline GtkAppChooserOnline;
-typedef struct _GtkAppChooserOnlineInterface GtkAppChooserOnlineInterface;
-
-struct _GtkAppChooserOnlineInterface {
-  GTypeInterface g_iface;
-
-  /* Methods */
-  void (*search_for_mimetype_async)      (GtkAppChooserOnline  *self,
-                                          const gchar          *content_type,
-                                          GtkWindow            *parent,
-                                          GCancellable         *cancellable,
-                                          GAsyncReadyCallback   callback,
-                                          gpointer              user_data);
-
-  gboolean (*search_for_mimetype_finish) (GtkAppChooserOnline  *self,
-                                          GAsyncResult         *res,
-                                          GError              **error);
-};
-
-GType                 _gtk_app_chooser_online_get_type                   (void) G_GNUC_CONST;
-
-void                  _gtk_app_chooser_online_get_default_async          (GAsyncReadyCallback   callback,
-                                                                          gpointer              user_data);
-GtkAppChooserOnline * _gtk_app_chooser_online_get_default_finish         (GObject             *source,
-                                                                          GAsyncResult        *result);
-
-void                  _gtk_app_chooser_online_search_for_mimetype_async  (GtkAppChooserOnline  *self,
-                                                                          const gchar          *content_type,
-                                                                          GtkWindow            *parent,
-                                                                          GCancellable         *cancellable,
-                                                                          GAsyncReadyCallback   callback,
-                                                                          gpointer              user_data);
-gboolean              _gtk_app_chooser_online_search_for_mimetype_finish (GtkAppChooserOnline  *self,
-                                                                          GAsyncResult         *res,
-                                                                          GError              **error);
-
-#endif /* __GTK_APP_CHOOSER_ONLINE_H__ */
diff --git a/gtk/gtkappchooseronlinepk.c b/gtk/gtkappchooseronlinepk.c
deleted file mode 100644 (file)
index 85722b2..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * gtkappchooseronlinepk.c: packagekit module for app-chooser
- *
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <ccecchi@redhat.com>
- */
-
-#include "config.h"
-
-#include "gtkappchooseronlinepk.h"
-
-#include "gtkappchooseronline.h"
-#ifdef GDK_WINDOWING_X11
-#include "x11/gdkx.h"
-#endif
-
-#include <gio/gio.h>
-
-#define gtk_app_chooser_online_pk_get_type _gtk_app_chooser_online_pk_get_type
-static void app_chooser_online_iface_init (GtkAppChooserOnlineInterface *iface);
-static void app_chooser_online_pk_async_initable_init (GAsyncInitableIface *iface);
-
-struct _GtkAppChooserOnlinePkPrivate {
-  GSimpleAsyncResult *init_result;
-  guint watch_id;
-
-  GDBusProxy *proxy;
-  GSimpleAsyncResult *result;
-  GtkWindow *parent;
-};
-
-G_DEFINE_TYPE_WITH_CODE (GtkAppChooserOnlinePk, gtk_app_chooser_online_pk,
-                         G_TYPE_OBJECT,
-                         G_ADD_PRIVATE (GtkAppChooserOnlinePk)
-                         G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
-                                                app_chooser_online_pk_async_initable_init)
-                         G_IMPLEMENT_INTERFACE (GTK_TYPE_APP_CHOOSER_ONLINE,
-                                                app_chooser_online_iface_init)
-                         g_io_extension_point_implement ("gtkappchooser-online",
-                                                         g_define_type_id,
-                                                         "packagekit", 10));
-
-static void
-gtk_app_chooser_online_pk_dispose (GObject *obj)
-{
-  GtkAppChooserOnlinePk *self = GTK_APP_CHOOSER_ONLINE_PK (obj);
-
-  g_clear_object (&self->priv->result);
-  g_clear_object (&self->priv->proxy);
-
-  G_OBJECT_CLASS (gtk_app_chooser_online_pk_parent_class)->dispose (obj);
-}
-
-static void
-gtk_app_chooser_online_pk_class_init (GtkAppChooserOnlinePkClass *klass)
-{
-  GObjectClass *oclass = G_OBJECT_CLASS (klass);
-
-  oclass->dispose = gtk_app_chooser_online_pk_dispose;
-}
-
-static void
-gtk_app_chooser_online_pk_init (GtkAppChooserOnlinePk *self)
-{
-  self->priv = gtk_app_chooser_online_pk_get_instance_private (self);
-}
-
-static gboolean
-pk_search_mime_finish (GtkAppChooserOnline *obj,
-                       GAsyncResult *res,
-                       GError **error)
-{
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
-
-  return !g_simple_async_result_propagate_error (simple, error);
-}
-
-static void
-install_mime_types_ready_cb (GObject      *source,
-                             GAsyncResult *res,
-                             gpointer      user_data)
-{
-  GtkAppChooserOnlinePk *self = user_data;
-  GDBusProxy *proxy = G_DBUS_PROXY (source);
-  GError *error = NULL;
-  GVariant *variant;
-
-  variant = g_dbus_proxy_call_finish (proxy, res, &error);
-
-  if (variant == NULL)
-    {
-      /* don't show errors if the user cancelled the installation explicitely
-       * or if PK wasn't able to find any apps
-       */
-      if (g_strcmp0 (g_dbus_error_get_remote_error (error), "org.freedesktop.PackageKit.Modify.Cancelled") != 0 &&
-          g_strcmp0 (g_dbus_error_get_remote_error (error), "org.freedesktop.PackageKit.Modify.NoPackagesFound") != 0)
-        g_simple_async_result_set_from_error (self->priv->result, error);
-
-      g_error_free (error);
-    }
-
-  g_simple_async_result_complete (self->priv->result);
-  g_clear_object (&self->priv->result);
-}
-
-static void
-pk_search_mime_async (GtkAppChooserOnline *obj,
-                      const gchar         *content_type,
-                      GtkWindow           *parent,
-                      GCancellable        *cancellable,
-                      GAsyncReadyCallback  callback,
-                      gpointer             user_data)
-{
-  GtkAppChooserOnlinePk *self = GTK_APP_CHOOSER_ONLINE_PK (obj);
-  guint xid = 0;
-  GdkWindow *window;
-  const gchar *mime_types[2];
-
-  self->priv->result = g_simple_async_result_new (G_OBJECT (self),
-                                                  callback, user_data,
-                                                  _gtk_app_chooser_online_search_for_mimetype_async);
-
-#ifdef GDK_WINDOWING_X11
-  window = gtk_widget_get_window (GTK_WIDGET (parent));
-  if (GDK_IS_X11_WINDOW (window))
-    xid = GDK_WINDOW_XID (window);
-#endif
-
-  mime_types[0] = content_type;
-  mime_types[1] = NULL;
-
-  g_dbus_proxy_call (self->priv->proxy,
-                     "InstallMimeTypes",
-                     g_variant_new ("(u^ass)",
-                                    xid,
-                                    mime_types,
-                                    "hide-confirm-search"),
-                     G_DBUS_CALL_FLAGS_NONE,
-                     G_MAXINT, /* no timeout */
-                     cancellable,
-                     install_mime_types_ready_cb,
-                     self);
-}
-
-static void
-app_chooser_online_iface_init (GtkAppChooserOnlineInterface *iface)
-{
-  iface->search_for_mimetype_async = pk_search_mime_async;
-  iface->search_for_mimetype_finish = pk_search_mime_finish;
-}
-
-static void
-pk_proxy_created_cb (GObject *source,
-                     GAsyncResult *result,
-                     gpointer user_data)
-{
-  GtkAppChooserOnlinePk *self = user_data;
-  GDBusProxy *proxy;
-
-  proxy = g_dbus_proxy_new_finish (result, NULL);
-
-  if (proxy == NULL)
-    {
-      g_simple_async_result_set_op_res_gboolean (self->priv->init_result, FALSE);
-    }
-  else
-    {
-      g_simple_async_result_set_op_res_gboolean (self->priv->init_result, TRUE);
-      self->priv->proxy = proxy;
-    }
-
-  g_simple_async_result_complete (self->priv->init_result);
-  g_clear_object (&self->priv->init_result);
-}
-
-static void
-pk_appeared_cb (GDBusConnection *conn,
-                const gchar *name,
-                const gchar *owner,
-                gpointer user_data)
-{
-  GtkAppChooserOnlinePk *self = user_data;
-
-  /* create the proxy */
-  g_dbus_proxy_new (conn, 0, NULL,
-                    "org.freedesktop.PackageKit",
-                    "/org/freedesktop/PackageKit",
-                    "org.freedesktop.PackageKit.Modify",
-                    NULL,
-                    pk_proxy_created_cb,
-                    self);
-
-  g_bus_unwatch_name (self->priv->watch_id);
-}
-
-static void
-pk_vanished_cb (GDBusConnection *conn,
-                const gchar *name,
-                gpointer user_data)
-{
-  GtkAppChooserOnlinePk *self = user_data;
-
-  /* just return */
-  g_simple_async_result_set_op_res_gboolean (self->priv->init_result, FALSE);
-  g_simple_async_result_complete (self->priv->init_result);
-
-  g_bus_unwatch_name (self->priv->watch_id);
-
-  g_clear_object (&self->priv->init_result);
-}
-
-static gboolean
-app_chooser_online_pk_init_finish (GAsyncInitable *init,
-                                   GAsyncResult *res,
-                                   GError **error)
-{
-  return g_simple_async_result_get_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (res));
-}
-
-static void
-app_chooser_online_pk_init_async (GAsyncInitable *init,
-                                  int io_priority,
-                                  GCancellable *cancellable,
-                                  GAsyncReadyCallback callback,
-                                  gpointer user_data)
-{
-  GtkAppChooserOnlinePk *self = GTK_APP_CHOOSER_ONLINE_PK (init);
-
-  self->priv->init_result = g_simple_async_result_new (G_OBJECT (self),
-                                                       callback, user_data,
-                                                       _gtk_app_chooser_online_get_default_async);
-
-  self->priv->watch_id =
-    g_bus_watch_name (G_BUS_TYPE_SESSION,
-                      "org.freedesktop.PackageKit",
-                      G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
-                      pk_appeared_cb,
-                      pk_vanished_cb,
-                      self,
-                      NULL);
-}
-
-static void
-app_chooser_online_pk_async_initable_init (GAsyncInitableIface *iface)
-{
-  iface->init_async = app_chooser_online_pk_init_async;
-  iface->init_finish = app_chooser_online_pk_init_finish;
-}
diff --git a/gtk/gtkappchooseronlinepk.h b/gtk/gtkappchooseronlinepk.h
deleted file mode 100644 (file)
index 8897858..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * gtkappchooseronlinepk.h: an extension point for online integration
- *
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <ccecchi@redhat.com>
- */
-
-#ifndef __GTK_APP_CHOOSER_ONLINE_PK_H__
-#define __GTK_APP_CHOOSER_ONLINE_PK_H__
-
-#include <gtk/gtkappchooseronline.h>
-#include <glib.h>
-
-#define GTK_TYPE_APP_CHOOSER_ONLINE_PK            (_gtk_app_chooser_online_pk_get_type ())
-#define GTK_APP_CHOOSER_ONLINE_PK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_PK, GtkAppChooserOnlinePk))
-#define GTK_APP_CHOOSER_ONLINE_PK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APP_CHOOSER_ONLINE_PK, GtkAppChooserOnlinePkClass))
-#define GTK_IS_APP_CHOOSER_ONLINE_PK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_PK))
-#define GTK_IS_APP_CHOOSER_ONLINE_PK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APP_CHOOSER_ONLINE_PK))
-#define GTK_APP_CHOOSER_ONLINE_PK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_PK, GtkAppChooserOnlinePkClass))
-
-typedef struct _GtkAppChooserOnlinePk        GtkAppChooserOnlinePk;
-typedef struct _GtkAppChooserOnlinePkClass   GtkAppChooserOnlinePkClass;
-typedef struct _GtkAppChooserOnlinePkPrivate GtkAppChooserOnlinePkPrivate;
-
-struct _GtkAppChooserOnlinePk {
-  GObject parent;
-
-  GtkAppChooserOnlinePkPrivate *priv;
-};
-
-struct _GtkAppChooserOnlinePkClass {
-  GObjectClass parent_class;
-};
-
-GType _gtk_app_chooser_online_pk_get_type (void);
-
-#endif /* __GTK_APP_CHOOSER_ONLINE_PK_H__ */